<template>
	<view>
		<view class="tab">
			<view :class="navIndex==1?'activite':''" @click="checkIndex(1)">职位</view>
			<view :class="navIndex==2?'activite':''" @click="checkIndex(2)">帖子</view>
		</view>
		<view class="content" v-if="navIndex==1">
		      <view v-for="(item,index) in allList" :key="index" @click="toDetails(navIndex,index)">
				<card :reciveAllzhao="item" ></card>
		      </view>
		</view>
		<view class="content" v-if="navIndex==2">
		<view v-for="(item,index) in all0List" :key="index" @click="getdetail(listIndex,index)">
			<tie :reciveAll="item" ></tie>
		</view>
		</view>
	</view>
</template>

<script>
	import card from"../../components/card.vue"
	import tie from "../../components/tie.vue"
	export default {
		components:{
			card,
			tie,
		},
		data() {
			return {
				navIndex:1,
				allList:[],
				all0List:[],
				
			}
		},
		onShow() {
			uni.request({
				url:"https://hotenergy.club/workapp/user/get_wc/1",
				method:"GET",
				data:"",
				success:(res)=>{
					console.log('收藏的帖子',res.data);
					this.allList=res.data;
				},
			}),
			uni.request({
				url:"https://hotenergy.club/workapp/user/get_sc/1",
				method:"GET",
				data:"",
				success:(res)=>{
					//console.log(res.data);
					this.all0List=res.data;
				},
			})
		},
		methods: {
			checkIndex(index){//tab全部实习校招
				this.navIndex=index;
			},
			toDetails(navIndex,index){//转到详情页
				console.log('index,navIndex',index,navIndex),
				this.id=index+1;
				//console.log(this.id),
				uni.navigateTo({
					url:'neirong?&id='+this.id+'&navIndex='+navIndex+'&index='+index,
				})
			},
			getdetail(navIndex,index){//转到详情页
				console.log('navIndex,index',navIndex,index),
				this.id=index+1;
				//console.log(this.id),
				uni.navigateTo({
					url:'detail?&navIndex='+navIndex+'&index='+index,
				})
			}
		}
	}
</script>

<style>
.tab{
	margin: 20rpx 170rpx 25rpx 170rpx;//上右下左
	display: flex;//flex容器
	flex-direction: row;//元素按hang排
	justify-content: space-between;
	
}
.activite{
	font-weight: bold;
	color: #666FFC;
}
</style>
